/**
 * Created by 10337 on 2017/5/30.
 */
public class Stackss {
    private int top;
    private char[] stackArray;
    private int maxSize;
    //constructor
    public Stackss(int maxSize){
        this.maxSize = maxSize;
        this.top = -1;
        stackArray = new char[this.maxSize];
    }
    //put item on top of stack
    public void push(char push){
        stackArray[++top] = push;
    }
    //take item from top of stack
    public char pop(){
        return stackArray[top--];
    }
    //peek the top item from stack
    public char peek(){
        return stackArray[top];
    }
    //peek the character at index n
    public char peekN(int index){
        return stackArray[index];
    }
    //true if stack is empty
    public boolean isEmpty(){
        return (top == -1);
    }
    //return stack size
    public int size(){
        return top+1;
    }
}